package com.share.wechat.fristpage.controller;

import com.share.wechat.core.entity.QuoteDetail;
import com.share.wechat.core.service.QuoteDetailService;
import com.share.wechat.fristpage.entity.Test;
import com.share.wechat.fristpage.service.TestService;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;

/**
 * 测试使用
 * Created by wanter on 2017/9/27.
 */
@Controller
@RequestMapping("/web")
public class TestController {
    private final Logger logger = Logger.getLogger(this.getClass());
    @Autowired
    private QuoteDetailService quoteDetailService;

    @Autowired
    private TestService testService;

    @RequestMapping(value = "say", method = RequestMethod.GET)
    public String say(ModelMap map) {
        logger.info("进入这个方法内部了！！！");
        map.put("title", "hello world");
        return "core/index";
    }

    @RequestMapping(value = "search", method = RequestMethod.GET)
    public String say1(ModelMap map) {
        logger.info("进入这个方法内部了！！！");
        map.put("title", "hello world");
        return "/html/app-show/searchEasyWay_BaiDu";
    }

    @RequestMapping(value = "say2", method = RequestMethod.GET)
    public String say2() {
        logger.info("进入这个方法内部了！！！");
        String path = TestController.class.getResource("/").toString();
        logger.info(path);
        logger.info(path);



        /*map.put("title", "hello world");
        List<Test> lists = testService.getTests();
        logger.info(lists.size() + "");
        String detailId = "d044196e-b3b4-48bf-a2a9-29207fe06f12";
        QuoteDetail detail = quoteDetailService.getByDetailId(detailId);
        detail.setDescItem("324324324324324321213");
        quoteDetailService.updateOne(detail);*/
        return "/html/app-manager/main";
    }

    @RequestMapping(value = "say3", method = RequestMethod.GET)
    public String say3(ModelMap map) {
        logger.info("进入这个方法内部了！！！");
        map.put("title", "hello world");
        return "cc";
    }
}
